<template>
	<view class="view-root">
		<!-- <scroll-view :style="'height:' + (tableHeight)" scroll-y="true"> -->
			<uni-table style="height:80vh" border stripe emptyText="暂无更多数据"
				 @on-selection-change="onSelect">
				<uni-tr>
					<uni-th  v-for="(hitem,index) in tableHead" :key="index" align="left">{{hitem.name}}</uni-th>
				</uni-tr>
				<uni-tr v-for="(ditem,dindex) in tableData" :key="dindex" @click="onSelect">
					<uni-td>{{dindex}}</uni-td>
					<uni-td>{{ditem.name}}</uni-td>
					<uni-td>{{ditem.object}}</uni-td>
					<uni-td>{{ditem.machine}}</uni-td>
					<uni-td>{{ditem.role}}</uni-td>
					<uni-td>{{ditem.time}}</uni-td>
				</uni-tr>			
			</uni-table>
		<!-- </scroll-view> -->
	</view>
</template>

<script>
	export default {
		props: {
			tableHead: {
				type: Array
			},

			tableData: {
				type: Array
			},
			
			tableHeight:{
				type: Number
			}
		},

		data() {
			return {
				selectIndex: 0
			}
		},

		methods: {
			onSelect(e) {
			}
		}
	}
</script>

<style scoped lang="scss">
	.view-root {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-around;
		background-color: #3F536E;
	}
	
	.selectTable {
		background-color: #0062B0;
	}
</style>
